@use './variables.module' as *;
$headHeight: 60px;
#app {
  .main-container {
    min-height: calc(100vh - $headHeight);
    transition: margin-left 0.28s;
    margin-left: $sideBarWidth;
    margin-top: $headHeight;
    position: relative;
  }
  .tags-view-container {
    position: fixed;
    top: $headHeight;
    left: $sideBarWidth;
    right: 0;
    // width: calc(100vh - $sideBarWidth);
    z-index: 8;
  }

  .sidebar-container {
    transition: width 0.28s;
    width: $sideBarWidth !important;
    // background-color: $menuBg;
    height: calc(100vh - $headHeight);
    position: fixed;
    top: $headHeight;
    bottom: 0;
    left: 0;
    z-index: 5;
    overflow: hidden;
    border-right: 1px solid #dcdfe6;

    // reset element-ui css
    .horizontal-collapse-transition {
      transition: 0s width ease-in-out, 0s padding-left ease-in-out,
        0s padding-right ease-in-out;
    }

    .scrollbar-wrapper {
      overflow-x: hidden !important;
    }

    .el-scrollbar__bar.is-vertical {
      right: 0px;
    }

    .el-scrollbar {
      height: 100%;
    }

    &.has-logo {
      .el-scrollbar {
        height: calc(100% - 50px);
      }
    }
    // &.has-logo {
    //   .el-scrollbar {
    //     height: calc(100% - 240px);
    //   }

    //   .el-scrollbar-nohashelp {
    //     height: calc(100% - 70px);
    //   }
    // }

    .is-horizontal {
      display: none;
    }

    .svg-icon {
      margin-right: 16px;
    }
    // .reference-block {
    //   width: auto !important;
    //   // padding-right: 12px !important;
    //   margin: 0 !important;
    //   background: none !important;
    //   .icon-bg {
    //     font-size: 16px;
    //     width: 1em;
    //     height: 1em;
    //   }
    //   .svg-icon {
    //     display: block;
    //     background-color: $menuText;
    //     border-radius: 5px;
    //     margin: 0 8px 0 4px;
    //   }
    //   .img {
    //     display: block;
    //     height: 24px;
    //     width: 24px;
    //     border-radius: 0;
    //   }
    // }

    .sub-el-icon {
      margin-right: 6px;
      margin-left: -2px;
    }

    .el-menu {
      border: none;
      height: 100%;
      width: 100% !important;
    }
    // menu hover
    .submenu-title-noDropdown,
    .el-sub-menu__title {
      padding: 0 20px;
      color: rgb(19, 19, 20);
      // background-color: rgb(255, 255, 255);
      height: 48px;
      line-height: 48px;
      &:hover {
        background-color: #fff !important;
        color: var(--el-color-primary);
      }
    }
    .el-menu-item.is-active {
      background-color: #E8F3FF !important;
      border-right: 3px solid #004FFF;
    }
    .el-sub-menu .el-sub-menu > .el-sub-menu__title {
      padding-left: 40px !important;
    }
    .el-menu-item.is-active > .el-sub-menu__title {
      color: $subMenuActiveText !important;
    }

    .el-menu-item.is-active .el-sub-menu__title .reference-block .svg-icon {
      background-color: $subMenuActiveText !important;
    }
    .el-menu-item.is-active .reference-block .svg-icon {
      background-color: $subMenuActiveText !important;
    }
    & .nest-menu .el-sub-menu > .el-sub-menu__title,
    & .el-sub-menu .el-menu-item {
      min-width: $sideBarWidth !important;
      background-color: $subMenuBg;
      height: 42px;
      line-height: 42px;
      &:hover {
        color: var(--el-color-primary) !important;
      }
    }
  }

  .hideSidebar {
    .sidebar-container {
      width: $sideCollapseMenuWidth !important;
      .svg-icon {
        margin-right: 0px;
      }
    }

    .main-container {
      margin-left: 54px;
    }

    .submenu-title-noDropdown {
      height: 48px !important;
      line-height: 48px !important;
      padding: 0 !important;
      position: relative;

      .el-tooltip {
        padding: 0 !important;

        .svg-icon {
          margin-left: 0px !important;
        }

        .sub-el-icon {
          margin-left: 19px;
        }
      }
    }

    .el-sub-menu {
      overflow: hidden;

      & > .el-sub-menu__title {
        padding: 0 !important;
        justify-content: center;
        .svg-icon {
          margin-left: 0px !important;
        }

        .sub-el-icon {
          margin-left: 19px;
        }

        .el-sub-menu__icon-arrow {
          display: none;
        }
      }
      .reference-block {
        padding: 0 !important;
      }
    }

    .el-menu--collapse {
      .el-sub-menu {
        & > .el-sub-menu__title {
          & > span {
            height: 0;
            width: 0;
            overflow: hidden;
            visibility: hidden;
            display: inline-block;
          }
        }
      }
    }
    .tags-view-container {
      left: $sideCollapseMenuWidth;
    }
  }

  .el-menu--collapse .el-menu .el-sub-menu {
    min-width: $sideBarWidth !important;
  }

  // mobile responsive
  .mobile {
    .main-container {
      margin-left: 0px;
    }

    .sidebar-container {
      transition: transform 0.28s;
      width: $sideBarWidth !important;
    }

    &.hideSidebar {
      .sidebar-container {
        pointer-events: none;
        transition-duration: 0.3s;
        transform: translate3d(-$sideBarWidth, 0, 0);
      }
    }
  }

  .withoutAnimation {
    .main-container,
    .sidebar-container {
      transition: 0.2s;
    }
  }
}

// when menu collapsed
.el-menu--vertical {
  & > .el-menu {
    .svg-icon {
      margin-right: 16px;
    }
    .sub-el-icon {
      margin-right: 12px;
      margin-left: -2px;
    }
  }
  .nest-menu .el-sub-menu > .el-sub-menu__title,
  .el-menu-item {
    &:hover {
      // you can use $subMenuHover
      // background-color: $menuHover !important;
    }
  }

  // the scroll bar appears when the subMenu is too long
  > .el-menu--popup {
    max-height: 100vh;
    overflow-y: auto;

    &::-webkit-scrollbar-track-piece {
      background: #d3dce6;
    }

    &::-webkit-scrollbar {
      width: 6px;
    }

    &::-webkit-scrollbar-thumb {
      background: #99a9bf;
      border-radius: 20px;
    }
  }
}
/* 左侧菜单样式 */
:deep(.el-sub-menu__title) {
  height: 48px;
  line-height: 48px;
  .el-menu-item {
    height: 48px;
    line-height: 48px;
  }
}
body[layout='mix'] {
  .horizontal-header {
    .el-menu-item {
      height: 50px !important;
      line-height: 50px !important;
    }

    .el-sub-menu__title {
      background-color: #001529 !important;
      height: 50px !important;
    }
  }
  .horizontal-header-right > div {
    color: #fff;
  }
  .svg-icon {
    margin-right: 16px;
  }
}
.el-popper {
  .reference-block {
    width: auto !important;
    margin: 0 !important;
    background: none !important;
    padding-right: 12px !important;
    .icon-bg {
      font-size: 16px !important;
      width: 1em;
      height: 1em;
    }
    .svg-icon {
      display: block !important;
      background-color: $menuText;
      border-radius: 5px;
      margin: 0 8px 0 4px;
    }
    .img {
      display: block;
      height: 24px;
      width: 24px;
      border-radius: 0;
    }
  }
  .is-active .reference-block .svg-icon {
    background-color: $subMenuActiveText !important;
  }
}
:deep(#app .is-active .reference-block .svg-icon) {
  background-color: $subMenuActiveText !important;
}

.el-sub-menu.is-active>.el-sub-menu__title {
  color: var(--el-color-primary) !important;
}